Fix preconditions in set_max_content_size setters
authorMatthias Clasen <mclasen@redhat.com>
Tue, 7 Jun 2016 20:35:06 +0000 (16:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 7 Jun 2016 20:37:09 +0000 (16:37 -0400)
We must allow resetting the properties to -1.

gtk/gtkscrolledwindow.c

index 1fbf189c75eb1e108f02f3955ad587526aa95352..0534c9378f3f025591b0b6d13bdb326631ff2e62 100644 (file)
@@ -4488,7 +4488,7 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->max_content_width == -1 || width <= priv->max_content_width);
+  g_return_if_fail (width == -1 || priv->max_content_width == -1 || width <= priv->max_content_width);
 
   if (priv->min_content_width != width)
     {
@@ -4542,7 +4542,7 @@ gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->max_content_height == -1 || height <= priv->max_content_height);
+  g_return_if_fail (height == -1 || priv->max_content_height == -1 || height <= priv->max_content_height);
 
   if (priv->min_content_height != height)
     {
@@ -4626,7 +4626,7 @@ gtk_scrolled_window_set_max_content_width (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->min_content_width == -1 || width >= priv->min_content_width);
+  g_return_if_fail (width == -1 || priv->min_content_width == -1 || width >= priv->min_content_width);
 
   if (width != priv->max_content_width)
     {
@@ -4678,7 +4678,7 @@ gtk_scrolled_window_set_max_content_height (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->min_content_height == -1 || height >= priv->min_content_height);
+  g_return_if_fail (height == -1 || priv->min_content_height == -1 || height >= priv->min_content_height);
 
   if (height != priv->max_content_height)
     {